package com.pcbly.web.persistence.timesheet;
 
import com.pcbly.web.components.utils.random.GUID;
import com.pcbly.web.bean.timesheet.TimesheetCommentBean;
import com.pcbly.web.persistence.HibernateBaseDao;
 
public class TimesheetCommentHibernateDao extends HibernateBaseDao<TimesheetCommentBean> implements TimesheetCommentDao {
	/**
	 * 
	 */
	private static final long serialVersionUID = 7253563055323255488L;
	protected Class<TimesheetCommentBean> getEntityClass() {
		return TimesheetCommentBean.class;
	}

	public TimesheetCommentHibernateDao() {
		super();
	}
	@Override 
	public void saveTimesheetCommentBean(TimesheetCommentBean timesheet) throws Exception{
		if(logger.isDebugEnabled()){
			logger.debug(timesheet.getId());
		}
		String id=(new GUID()).toString();
		timesheet.setId(id);
		getHibernateTemplate().save(timesheet);
	}
	@Override
	public void removeTimesheetCommentBeanByIds(String ids) throws Exception {
		// TODO Auto-generated method stub
		ids = ids.replaceAll(",", "','");
		String hsql = "delete from t_timesheet_reason where ID in( '" + ids + "')";
		getSession().createSQLQuery(hsql).executeUpdate();
		
	}
}